package com.burstly.lib.component.networkcomponent.burstly.html.mraid;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build.VERSION;
import android.view.View;
import android.view.Window;
import com.burstly.lib.util.Utils;
import java.util.HashMap;
import java.util.Map;

@SuppressLint({"NewApi"})
class DevaceCapabilitiesManager
{
  private static final String CALENDAR = "calendar";
  private static final String EMAIL = "email";
  private static final String INLINE_VIDEO = "inlineVideo";
  private static final String SMS = "sms";
  private static final String STORE_PICTURE = "storePicture";
  private static final String TEL = "tel";

  private static boolean checkCanHandle(Context paramContext, String paramString)
  {
    Intent localIntent = new Intent();
    localIntent.setData(Uri.parse(paramString));
    return paramContext.getPackageManager().resolveActivity(localIntent, 65536) != null;
  }

  static Map<String, String> getCapabilities(Context paramContext)
  {
    JsonMap localJsonMap = new JsonMap(7);
    if (supportsTelephony(paramContext))
      localJsonMap.put("tel", "true");
    if (supportsSms(paramContext))
      localJsonMap.put("sms", "true");
    if (supportsEmail(paramContext))
      localJsonMap.put("email", "true");
    if (supportsCalendar(paramContext))
      localJsonMap.put("calendar", "true");
    if (supportsStorePicture(paramContext))
      localJsonMap.put("storePicture", "true");
    if (supportsInlineVideo(paramContext))
      localJsonMap.put("inlineVideo", "true");
    return localJsonMap;
  }

  private static boolean supportsCalendar(Context paramContext)
  {
    Intent localIntent;
    if (Build.VERSION.SDK_INT < 14)
    {
      localIntent = new Intent("android.intent.action.EDIT");
      localIntent.setType("vnd.android.cursor.item/event");
    }
    return paramContext.getPackageManager().resolveActivity(localIntent, 65536) != null;
  }

  private static boolean supportsEmail(Context paramContext)
  {
    return checkCanHandle(paramContext, "mailto:");
  }

  private static boolean supportsInlineVideo(Context paramContext)
  {
    if (Build.VERSION.SDK_INT >= 11)
    {
      localView = ((Activity)paramContext).getWindow().getDecorView();
      if ((Build.VERSION.SDK_INT < 12) || (!localView.isHardwareAccelerated()));
    }
    while (Build.VERSION.SDK_INT >= 12)
    {
      View localView;
      return true;
      return false;
    }
    return false;
  }

  private static boolean supportsSms(Context paramContext)
  {
    return checkCanHandle(paramContext, "sms:");
  }

  private static boolean supportsStorePicture(Context paramContext)
  {
    return true;
  }

  private static boolean supportsTelephony(Context paramContext)
  {
    return checkCanHandle(paramContext, "tel:");
  }

  private static class JsonMap extends HashMap<String, String>
  {
    private static final long serialVersionUID = 3239003272496231742L;

    JsonMap(int paramInt)
    {
      super();
    }

    public String toString()
    {
      return Utils.toJson(this);
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.burstly.lib.component.networkcomponent.burstly.html.mraid.DevaceCapabilitiesManager
 * JD-Core Version:    0.6.2
 */